﻿namespace Example.Structural
{
    using System.Globalization;
    using System.Net.Mail;

    using Example.Structural.Adapter;

    using Xunit;

    /// <summary>
    /// Convert the interface of a class into another interface clients expect.
    /// Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
    /// </summary>
    public sealed class AdapterFacts
    {
        [Fact]
        public void adapt_to_be_convertible()
        {
            var collection = new ConvertibleCollection
                                 {
                                     123, 
                                     "hello", 
                                     new MailAddress("john.doe@example.com")
                                 };

            foreach (var item in collection)
            {
                Assert.NotNull(item.ToString(CultureInfo.InvariantCulture));
            }
        }
    }
}